package io.github.fb513.transport.queue;

import com.rabbitmq.client.ConnectionFactory;
import io.github.fb513.transport.config.RabbitMQConfig;

/**
 * @author fengbo
 * @since 2023/12/25 14:57
 */
public class MessageQueueServer {

    private final ConnectionFactory connectionFactory;

    public MessageQueueServer(RabbitMQConfig config) {
        this.connectionFactory = new ConnectionFactory();
        this.connectionFactory.setHost(config.getHost());
        this.connectionFactory.setPort(config.getPort());
        this.connectionFactory.setUsername(config.getUsername());
        this.connectionFactory.setPassword(config.getPassword());
        this.connectionFactory.setVirtualHost(config.getVirtualHost());
    }

    public ConnectionFactory getConnectionFactory() {
        return connectionFactory;
    }
}
